// 文艺平衡树
// https://www.luogu.com.cn/problem/P3391
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
using ll = long long;
using T = int;
T rad(); // quick read
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
const int max_size = 5 + 100;
const int maxn = 5 + 1e5;

class Treap {
  private:
    int tot;
    int val[maxn << 5], pri[maxn << 5];
    int siz[maxn << 5];
    int ch[maxn << 5][2];
    int tag[maxn << 5];

    int new_node(int x) { return val[++tot] = x, pri[tot] = rand(), siz[tot] = 1, ch[tot][0] = 0, ch[tot][1] = 0, tot; }
    void maintain(int u) { siz[u] = siz[ch[u][0]] + siz[ch[u][1]] + 1; }
    // int cp(int u) { return val[++tot] = val[u], pri[tot] = pri[u], siz[tot] = siz[u], ch[tot][0] = ch[u][0], ch[tot][1] = ch[u][1], tot; }
    void update_node(int u) { swap(ch[u][0], ch[u][1]), tag[u] ^= 1; }
    void push_down(int u) {
        if (tag[u] == 0) return;
        update_node(ch[u][0]);
        update_node(ch[u][1]);
        tag[u] = 0;
    }

    void split(int u, int rk, int &l, int &r) { // 按  rk 拆分 u 子树，l <= key，r >  rk
        if (u == 0) {
            l = r = 0;
            return;
        }
        push_down(u);
        // u = cp(u);
        int cnt = siz[ch[u][0]] + 1;
        if (cnt <= rk) // l <= rk, r > rk
            l = u, split(ch[u][1], rk - cnt, ch[u][1], r);
        else
            split(ch[u][0], rk, l, ch[u][0]), r = u;
        maintain(u);
    }

    int merge(int u, int v) {
        if (u == 0 || v == 0)
            return u ^ v;
        if (pri[u] > pri[v]) {
            push_down(u);
            // u = cp(u);
            ch[u][1] = merge(ch[u][1], v), maintain(u);
            return u;
        } else {
            push_down(v);
            // v = cp(v);
            ch[v][0] = merge(u, ch[v][0]), maintain(v);
            return v;
        }
    }

  public:
    int insert(int root, int x) {
        int l, r, u = new_node(x);
        split(root, x, l, r);
        return merge(merge(l, u), r);
    }
    int erase(int root, int x) {
        int l, mid, r;
        split(root, x, l, r);
        split(l, x - 1, l, mid);
        return merge(merge(l, merge(ch[mid][0], ch[mid][1])), r);
    }
    void show(int u, int dep = 1) {
        if (u == 0) return;
        push_down(u);
        show(ch[u][0], dep + 1);
        // printf("|| val: %d, deep: %d, siz: %d, u: %d\n", val[u], dep, siz[u], u);
        printf("%d ", val[u]);
        show(ch[u][1], dep + 1);
    }
    int rev(int root, int s, int t) {
        int l, mid, r;
        split(root, t, mid, r);
        split(mid, s - 1, l, mid);
        update_node(mid);
        return merge(merge(l, mid), r);
    }
} tp;

// int root[maxn << 2], rsiz;
int root;
int main() {
    // freopen("main.in", "r", stdin);
    int n = rad(), m = rad();
    for (int i = 1; i <= n; ++i) root = tp.insert(root, i);
    rf(i, m) {
        int l = rad(), r = rad();
        root = tp.rev(root, l, r);
    }
    tp.show(root, 1);
}

T rad() {
    T back = 0;
    int ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar()) posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar()) back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}